﻿using System;
using System.Collections.Generic;
using System.Web;
using hdbankwebservice.DTO;
using System.Collections;
using System.Data.SqlClient;
using System.Data;
using System.Data.Common;

namespace hdbankwebservice.DAO
{
    public class PhiGiaoDichDAO
    {
        public static int LayPhiHienHanh(int nhompgd,string tennganhang)
        {
            SQLDataAccessHelper dl = new SQLDataAccessHelper();
            string sqlString = string.Format(@"SELECT * FROM PHIGIAODICH WHERE PHIGIAODICH.MANHOMPHIGIAODICH ={0} AND PHIGIAODICH.TENNGANHANG='{1}'",nhompgd,tennganhang);

            SqlCommand sql = new SqlCommand(sqlString);
            DataTable dt = dl.ThucThiTruyVan(sql);
            if (dt.Rows.Count == 0)
            {
                return 0;
            }
            else
            {
                PhiGiaoDich pgd = new PhiGiaoDich();
                pgd.PhiHienHanh= (int)dt.Rows[0]["PHIHIENHANH"];
                return pgd.PhiHienHanh;
            }
        }
    }
}